﻿namespace CodeParser.Tokens
{
    public class SingleKeyword
        : TokenParser
    {

        public SingleKeyword(TokenType type, string keyword)
            : base(type)
        {
            Keyword = keyword;
        }

        public override Token GetTokenAt(string source, int index)
        {
            if (StringUtils.Matches(source, index, Keyword))
            {
                return new Token() { Index = index, Type = Type.Value, Value = source.Substring(index, Keyword.Length) };
            }
            return null;
        }

        public string Keyword;

    }
}
